package com.baike.service.impl;

import com.baike.entity.MongodbComment;
import com.baike.service.MongodbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author:pjm
 */
@Service
public class MongodbServiceImpl implements MongodbService {
    @Autowired
    private MongoTemplate mongoTemplate;

    //评论增加
    @Override
    public MongodbComment addComment(MongodbComment mongodbComment) {
        return mongoTemplate.save(mongodbComment);
    }
    //根据条件查询评论
    @Override
    public MongodbComment selectById(Long commentId) {
        MongodbComment comment = mongoTemplate.findById(commentId, MongodbComment.class);
        return comment;
    }

}
